﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using QLBH.Model.Controller;
using QLBH.DataModel;
using QLBH.ModelInterface;
using QLBH.ModelFactory;

namespace Module.SystemUI.Presenter
{
    public class UserManagementPresenter
    {
        private static UserManagementPresenter instance;

        public static UserManagementPresenter Instance
        {
            get 
            { 
                if (instance==null)
                {
                    instance = new UserManagementPresenter();
                }
                return UserManagementPresenter.instance; 
            }
            
        }
        public UserManagementPresenter()
        {

        }
        public List<IUserManagementModel> GetDSUsers()
        {
            try
            {
                List<IUserManagementModel> results = new List<IUserManagementModel>();
                var users = AcountController.GetInstance().GetAll();

                foreach (ACOUNT entity in users)
                {
                    IUserManagementModel model = ModelFactory.GetUserManagementModelInstance();
                    model.InitFromEntity(entity);

                    results.Add(model);
                }
                return results;
            }
            catch (System.Exception ex)
            {
                throw ex;
            }

        }

    }
}
